#include "fxcc/imgui/Editor.h"
#include "fxcc/core/audio/common/Maps.h"
#include "fxcc/core/Dir.h"

using namespace fxcc::audio::common;
using namespace fxcc::imgui;

template <>
bool Editor::Edit<Source::Desc>(const std::string& label, Source::Desc& inst)
{
    bool flag{ 0 };
    static std::map<Source::Desc::Type, std::string> ls =
    {
        {Source::Desc::Type::_Wav_ , "_Wav_" },
        {Source::Desc::Type::_Ogg_ , "_Ogg_" },
    };

    ComboEnumMap<Source::Desc::Type>("m_Type", inst.m_Type, ls);
    EditInst<std::string>("m_OggPath", inst.m_OggPath);
    EditInst<std::string>("m_WavPath", inst.m_WavPath);

    return flag;
}

template <>
bool Editor::Edit<Source>(const std::string& label, Source& inst)
{
    bool flag{ 0 };


    EditInst<Source::Desc>("m_Desc", inst.m_Desc);
    if (ImGui::Button("Play"))
    {
        inst.Play();
    }
    ImGui::SameLine();
    if (ImGui::Button("Pause"))
    {
        inst.Pause();
    }
    ImGui::SameLine();
    if (ImGui::Button("Stop"))
    {
        inst.Stop();
    }
    ImGui::SameLine();

    return flag;
}